from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep

driver =webdriver.Edge()
sleep(1)
# 浏览器获取网址事件
driver.get('https://www.126.com/')
sleep(1)
# 浏览器窗口放大事件
driver.maximize_window()
sleep(5)
# 浏览器窗刷新事件
driver.refresh()
sleep(2)
# 窗口切换
driver.switch_to.window(driver.window_handles[-1])
sleep(10)
# frame框架
f = driver.find_element(By.ID,'x-URS-iframe1748917902980.1875')
driver.switch_to.frame(f)
sleep(3)
# 退出frame框架
driver.switch_to.default_content()
# 输入账号
driver.find_element(By.ID,'auto-id-1748916825083').send_keys('ltt18185603008')
sleep(2)
# 输入密码
driver.find_element(By.CLASS_NAME,'j-inputtext.dlpwd').send_keys('123456Aa')
sleep(2)
# 点击登录
driver.find_element(By.XPATH,'//*[@id="dologin"]').click()
sleep(2)
# 窗口切换
driver.switch_to.window(driver.window_handles[-1])
# 向下滚动500像素
driver.execute_script("window.scrollTo(0,500)")
sleep(10)



